<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台管理中心</title>
    <link href="{:asset('css/admin/reset.css')}" rel="stylesheet" type="text/css">
    <link href="{:asset('css/admin/zh-cn-system.css')}" rel="stylesheet" type="text/css">
    <link href="{:asset('css/admin/table_form.css')}" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="{:asset('js/jquery.min.js')}"></script>
    <script type="text/javascript" src="{:asset('js/jquery.cookie.js')}"></script>
    <script type="text/javascript" src="{:asset('js/admin/admin_common.js')}"></script>
    <script type="text/javascript" src="{:asset('js/JSCal/jscal2.js')}"></script>
    <script type="text/javascript" src="{:asset('js/JSCal/lang/cn.js')}"></script>
    <link rel="stylesheet" type="text/css" href="{:asset('css/JSCal/jscal2.css')}">
    <link rel="stylesheet" type="text/css" href="{:asset('css/JSCal/border-radius.css')}">
    <link rel="stylesheet" type="text/css" href="{:asset('css/JSCal/win2k/win2k.css')}">
    <link rel="stylesheet" type="text/css" href="{:asset('css/admin/upload.css')}">
</head>
<body>
    <div>
        <form name="myform" action="" method="get">
            <table width="100%" cellspacing="0" class="search-form">
                <tr>
                    <td>
                        <?php foreach ($_GET as $key => $value) {
                            echo "<input type='hidden' name='$key' value='$value'>";
                        } ?>
                        <div class="lh26 explain-col"> 时间：<input type="text" name="start_time" id="start_time" value="<?php echo I('get.start_time'); ?>" size="10" class="date input-text" readonly="">
                            <script type="text/javascript">
                                Calendar.setup({
                                    weekNumbers: false,
                                    inputField : "start_time",
                                    trigger    : "start_time",
                                    dateFormat: "%Y-%m-%d",
                                    showTime: false,
                                    minuteStep: 1,
                                    onSelect   : function() {this.hide();}
                                });
                            </script>&nbsp;-&nbsp;<input type="text" name="end_time" id="end_time" value="<?php echo I('get.end_time'); ?>" size="10" class="date input-text" readonly=""><script type="text/javascript">
                            Calendar.setup({
                                weekNumbers: false,
                                inputField : "end_time",
                                trigger    : "end_time",
                                dateFormat: "%Y-%m-%d",
                                showTime: false,
                                minuteStep: 1,
                                onSelect   : function() {this.hide();}
                            });
                        </script>
                        <label>名称</label>
                        <input type="text" value="<?php echo I('get.filename'); ?>" class="input-text" size="10" name="filename">
                        <input type="submit" value="搜索" class="button" name="search">
                    </div>
                </td>
            </tr>
        </table>
    </form>
    <ul class="attachment-list" id="fsUploadProgress">
        <?php foreach ($attachs as $key => $attach) { ?>
        <li>
            <div class="img-wrap">
                <a href="javascript:;" onclick="javascript:album_cancel(this,'<?php echo $attach['id']; ?>')">
                    <div class="icon"></div>
                    <?php if( in_array(strtolower($attach['ext']), array( 'jpg','gif','png','jpeg' ) )  ) { ?>
                    <img src="<?php echo IMAGE_DOMAIN . $attach['url']; ?>" width="80" path="<?php echo IMAGE_DOMAIN . $attach['url']; ?>" title="<?php echo $attach['title']; ?>">
                    <?php } else { ?>
                    <img src="<?php echo asset('images/admin/icon/'.$attach['ext'].'.png') ?>" width="80" path="<?php echo  IMAGE_DOMAIN . $attach['url']; ?>" title="<?php echo $attach['title']; ?>">
                    <?php } ?>
                </a>
            </div>
        </li>
        <?php } ?>
    </ul>
    <div id="pages"><?php echo $pages; ?></div>
</div>
<script type="text/javascript">
    function album_cancel(obj,id) {
        var src = $(obj).children("img").attr("path");
        var filename = $(obj).children("img").attr("title");

        if($(obj).hasClass('on')){
            $(obj).removeClass("on");
            var imgstr = parent.window.$("#att-status").html();
            var length = $("a[class='on']").children("img").length;
            var ids = strs = filenames = '';
            for(var i=0;i<length;i++){
                strs += '|'+$("a[class='on']").children("img").eq(i).attr('path');
                filenames += '|'+$("a[class='on']").children("img").eq(i).attr('title');
                ids += '|'+id;
            }
            parent.window.$('#att-status').html(strs);
            parent.window.$('#att-name').html(filenames);
            parent.window.$('#att-ids').html(ids);
        } else {
            var num = parent.window.$('#att-status').html().split('|').length;
            var file_upload_limit = <?php echo $params[2]; ?>;
            if(num > file_upload_limit) {alert('不能选择超过'+file_upload_limit+'个附件'); return false;}
            $(obj).addClass("on");
            parent.window.$('#att-status').append('|'+src);
            parent.window.$('#att-name').append('|'+filename);
            parent.window.$('#att-ids').append('|'+id);
        }
    }
</script>
</body>
</html>